package com.thx.common.util;

/**
 * 提供根据类实用工具.
 *
 * @author balance
 */
public class ObjectUtils {

  /**
   * 根据类名字符串返回类的实例.
   *
   * @return Object
   */
  public static Object getInstance(String className) {
    try {
      Class clazz = Class.forName(className);
      if (clazz == null) {
        JarClassLoader jcl = new JarClassLoader();
        clazz = jcl.loadClass(className);
      }
      Object obj = clazz.newInstance();
      return obj;
    } catch (Exception ex) {
      System.err.print(ex);
    }
    return null;
  }
}
